home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / X11 / Xmu / DisplayQue.h < prev    next >
C/C++ Source or Header  |  2006-04-12  |  4KB  |  156 lines

  1. /* $Xorg: DisplayQue.h,v 1.4 2001/02/09 02:03:52 xorgcvs Exp $ */
  2.  
  3. /*
  4.  
  5. Copyright 1994, 1998  The Open Group
  6.  
  7. Permission to use, copy, modify, distribute, and sell this software and its
  8. documentation for any purpose is hereby granted without fee, provided that
  9. the above copyright notice appear in all copies and that both that
  10. copyright notice and this permission notice appear in supporting
  11. documentation.
  12.  
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15.  
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  19. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  20. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22.  
  23. Except as contained in this notice, the name of The Open Group shall not be
  24. used in advertising or otherwise to promote the sale, use or other dealings
  25. in this Software without prior written authorization from The Open Group.
  26.  
  27. */
  28. /* $XFree86: xc/lib/Xmu/DisplayQue.h,v 1.5 2001/01/17 19:42:54 dawes Exp $ */
  29.  
  30. #ifndef _XMU_DISPLAYQUE_H_
  31. #define _XMU_DISPLAYQUE_H_
  32.  
  33. #include <X11/Xmu/CloseHook.h>
  34. #include <X11/Xfuncproto.h>
  35.  
  36. /*
  37.  *                  Public Entry Points
  38.  * 
  39.  * 
  40.  * XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data)
  41.  *     XmuCloseDisplayQueueProc closefunc;
  42.  *     XmuFreeDisplayQueueProc freefunc;
  43.  *     XPointer data;
  44.  * 
  45.  *         Creates and returns a queue into which displays may be placed.  When
  46.  *         the display is closed, the closefunc (if non-NULL) is upcalled with
  47.  *         as follows:
  48.  *
  49.  *                 (*closefunc) (queue, entry)
  50.  *
  51.  *         The freeproc, if non-NULL, is called whenever the last display is
  52.  *         closed, notifying the creator that display queue may be released
  53.  *         using XmuDQDestroy.
  54.  *
  55.  *
  56.  * Bool XmuDQDestroy (q, docallbacks)
  57.  *     XmuDisplayQueue *q;
  58.  *     Bool docallbacks;
  59.  * 
  60.  *         Releases all memory for the indicated display queue.  If docallbacks
  61.  *         is true, then the closefunc (if non-NULL) is called for each 
  62.  *         display.
  63.  * 
  64.  * 
  65.  * XmuDisplayQueueEntry *XmuDQLookupDisplay (q, dpy)
  66.  *     XmuDisplayQueue *q;
  67.  *     Display *dpy;
  68.  *
  69.  *         Returns the queue entry for the specified display or NULL if the
  70.  *         display is not in the queue.
  71.  *
  72.  * 
  73.  * XmuDisplayQueueEntry *XmuDQAddDisplay (q, dpy, data)
  74.  *     XmuDisplayQueue *q;
  75.  *     Display *dpy;
  76.  *     XPointer data;
  77.  *
  78.  *         Adds the indicated display to the end of the queue or NULL if it
  79.  *         is unable to allocate memory.  The data field may be used by the
  80.  *         caller to attach arbitrary data to this display in this queue.  The
  81.  *         caller should use XmuDQLookupDisplay to make sure that the display
  82.  *         hasn't already been added.
  83.  * 
  84.  * 
  85.  * Bool XmuDQRemoveDisplay (q, dpy)
  86.  *     XmuDisplayQueue *q;
  87.  *     Display *dpy;
  88.  *
  89.  *         Removes the specified display from the given queue.  If the 
  90.  *         indicated display is not found on this queue, False is returned,
  91.  *         otherwise True is returned.
  92.  */
  93.  
  94. typedef struct _XmuDisplayQueue XmuDisplayQueue;
  95. typedef struct _XmuDisplayQueueEntry XmuDisplayQueueEntry;
  96.  
  97. typedef int (*XmuCloseDisplayQueueProc)(XmuDisplayQueue *queue,
  98.                     XmuDisplayQueueEntry *entry);
  99.  
  100. typedef int (*XmuFreeDisplayQueueProc)(XmuDisplayQueue *queue);
  101.  
  102. struct _XmuDisplayQueueEntry {
  103.     struct _XmuDisplayQueueEntry *prev, *next;
  104.     Display *display;
  105.     CloseHook closehook;
  106.     XPointer data;
  107. };
  108.  
  109. struct _XmuDisplayQueue {
  110.     int nentries;
  111.     XmuDisplayQueueEntry *head, *tail;
  112.     XmuCloseDisplayQueueProc closefunc;
  113.     XmuFreeDisplayQueueProc freefunc;
  114.     XPointer data;
  115. };
  116.  
  117. _XFUNCPROTOBEGIN
  118.  
  119. XmuDisplayQueue *XmuDQCreate
  120. (
  121.  XmuCloseDisplayQueueProc    closefunc,
  122.  XmuFreeDisplayQueueProc    freefunc,
  123.  XPointer            data
  124.  );
  125.  
  126. Bool XmuDQDestroy
  127. (
  128.  XmuDisplayQueue        *q,
  129.  Bool                docallbacks
  130.  );
  131.  
  132. XmuDisplayQueueEntry *XmuDQLookupDisplay
  133. (
  134.  XmuDisplayQueue        *q,
  135.  Display            *dpy
  136.  );
  137.  
  138. XmuDisplayQueueEntry *XmuDQAddDisplay
  139. (
  140.  XmuDisplayQueue        *q,
  141.  Display            *dpy,
  142.  XPointer            data
  143.  );
  144.  
  145. Bool XmuDQRemoveDisplay
  146. (
  147.  XmuDisplayQueue        *q,
  148.  Display            *dpy
  149.  );
  150.  
  151. _XFUNCPROTOEND
  152.  
  153. #define XmuDQNDisplays(q) ((q)->nentries)
  154.  
  155. #endif /* _XMU_DISPLAYQUE_H_ */
  156.